import logo from './logo.svg';
import React from 'react'
import './App.css';
import MyRouter from './router/index.js';

// 引入相关的组件
import {Prompt,Switch,NavLink,BrowserRouter as Router ,Link ,withRouter ,Route,Redirect} from 'react-router-dom';
import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
import {UserOutlined,ShoppingCartOutlined} from "@ant-design/icons"
import MyHeader from './component/header/index.js'
import Index from './component/index/index.js'
import Mask from './component/mask'
import { Spin } from "antd";
class App extends React.Component {
	constructor() {
	    super();
		this.state = {
			loading:false,
			timer:null
		}
	}
	
	loadingShow=()=>{
	   this.setState(
	     {
	       loading: true
	     },
	     () => {
	       clearTimeout(this.timer);
	       this.timer = setTimeout(() => {
	         this.setState({ loading: false });
	       }, 1000);
	     }
	   );
	 }

 
 render(){
  return (
	<Router>
			<div>
			<Spin tip="Loading..." spinning={this.state.loading}>
				{/* 搜索栏*/}
				<MyHeader></MyHeader>
				<MyRouter loadingShow={this.loadingShow}></MyRouter>
				</Spin>
			</div>
	</Router>
  );
}}

export default App;
